package com.liu.controller;

import com.liu.bean.Order;
import com.liu.remote.GoodsRemoteClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
public class OrderController {

    @Autowired
    GoodsRemoteClient goodsRemoteClient;

    @PostMapping("/order")
    public String save(@RequestBody Order order){
        //System.out.println("生成订单："+order.toString());
        log.info("生成订单："+order.toString());
        String msg = goodsRemoteClient.update(order.getOrderDetails());
        return "ok";
    }

}
